package com.futu.es.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.dromara.easyes.annotation.IndexField;
import org.dromara.easyes.annotation.IndexId;
import org.dromara.easyes.annotation.rely.FieldType;
import org.dromara.easyes.annotation.rely.IdType;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.util.Date;

/**
 * 用户访问景点记录MongoDB实体类
 */
@Data
@Document(collection = "user_spot_visits")
@NoArgsConstructor
@AllArgsConstructor
@CompoundIndexes({
        @CompoundIndex(name = "user_spot_idx", def = "{'userId': 1, 'spotId': 1}")
})
public class MangodbSpot {
    @Id
    private String id;

    /**
     * 用户ID
     */
    @Field("user_id")
    @Indexed
    private Long userId;

    @Field("username")
    @Indexed
    private String username;

    /**
     * 景点ID
     */
    @Field("spot_id")
    @Indexed
    private Long spotId;

    /**
     * 景点名称
     */
    @Field("spot_name")
    private String name;

    /**
     * 景点简介
     */
    private String description;

    /**
     * 纬度
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private Double latitude;

    /**
     * 经度
     */
    @IndexField(fieldType = FieldType.DOUBLE)
    private Double longitude;

    /**
     * 全景图URL
     */
    @Field("panorama_url")
    @IndexField(fieldType = FieldType.KEYWORD)
    private String panoramaUrl;

    /**
     * 访问时间
     */
    @Field("visit_time")
    @Indexed
    private Date visitTime;

    /**
     * 停留时长(分钟)
     */
    @Field("duration")
    private Integer duration;

    /**
     * 访问类型 (1-首次访问, 2-再次访问)
     */
    @Field("visit_type")
    private Integer visitType;

    /**
     * 用户评分 (1-5分)
     */
    @Field("rating")
    private Integer rating;

    /**
     * 用户评论
     */
    @Field("comment")
    private String comment;

    /**
     * 创建时间
     */
    @Field("create_time")
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新时间
     */
    @Field("update_time")
    @IndexField(fieldType = FieldType.DATE, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;
}
